import { defHttp } from '/@/utils/http/axios';
import {
  ProjectParams,
  projectTypeSelectParams,
  projectManagerSelectParams,
  projectTemplateSelectParams,
  taskManagerParams,
  deleteProjectParams,
  createProjectParams,
} from './model/projectModel';

enum Api {
  Project_LIST = '/services/app/Task/SelectProjectParticipantTask',
  PROJECT_TYPE_OPTIONS_LIST = '/services/app/Resource/GetResourceList',
  projectManagerListApi = '/services/app/Task/GetProjManagerlistaboutuser',
  projectTemplateListApi = '/services/app/Template/GetList',
  projectParticipantsListApi = '/services/app/Orgs/GetAllOrgInfos',
  taskManagerApi = '/services/app/Task/Gettask',
  deleteProjectApi = '/services/app/Task/Deleteproandtask?projectid=',
  createProjectApi = '/api/services/app/Task/Addprojs',
}

/**
 * 模块名:项目管理-全部项目
 * 代码描述:
 * 作者:张泽源
 * 创建时间:2023/11/20 16:50:20
 */
export const projectListApi = (params: ProjectParams) =>
  defHttp.get({
    url: Api.Project_LIST,
    params,
  });
/**
 * 模块名:项目类型下拉框
 * 代码描述:
 * 作者:张泽源
 * 创建时间:2023/11/21 15:04:26
 */
export const projectTypeListApi = (params?: projectTypeSelectParams) =>
  defHttp.get<{}>({ url: Api.PROJECT_TYPE_OPTIONS_LIST, params });

/**
 * 模块名:负责人下拉框
 * 代码描述:
 * 作者:张泽源
 * 创建时间:2023/11/21 15:06:42
 */
export const projectManagerListApi = (params?: projectManagerSelectParams) =>
  defHttp.get<{}>({ url: Api.projectManagerListApi, params });

/**
 * 模块名:项目模板下拉框
 * 代码描述:
 * 作者:张泽源
 * 创建时间:2023/11/22 15:50:03
 */
export const projectTemplateListApi = (params?: projectTemplateSelectParams) =>
  defHttp.get<{}>({ url: Api.projectTemplateListApi, params });

/**
 * 模块名:项目参与人下拉框-部门下人员组织
 * 代码描述:
 * 作者:张泽源
 * 创建时间:2023/11/22 16:32:56
 */
export const projectParticipantsListApi = () =>
  defHttp.get<{}>({ url: Api.projectParticipantsListApi });

/**
 * 模块名:项目详情下，任务管理接口
 * 代码描述:
 * 作者:张泽源
 * 创建时间:2023/11/28 15:19:01
 */
export const taskManagerApi = (params?: taskManagerParams) =>
  defHttp.get<{}>({ url: Api.taskManagerApi, params });

/**
 * 模块名:删除项目接口
 * 代码描述:
 * 作者:张泽源
 * 创建时间:2023/12/11 17:24:54
 */

export const deleteProjectApi = (params?: deleteProjectParams) =>
  defHttp.delete<{}>({ url: Api.deleteProjectApi, params });

/**
 * 模块名:新增项目接口
 * 代码描述:
 * 作者:张泽源
 * 创建时间:2023/12/13 14:11:03
 */
export const createProjectApi = (params?: createProjectParams) =>
  defHttp.post<{}>({ url: Api.createProjectApi, params });
